#include<stdio.h>

struct youtai {
	int number;
};

int main() {
	youtai yt[1000] = {0};
	int m, n;
	scanf("%d %d", &m, &n);

	for (int i = 0; i < m; i++) {
		yt[i].number = i + 1;
	}

	int j = 0;
	int k = 0;
	int remaining = m;

	while (remaining > 0) {
		if(yt[j].number!=0)
			k++;
		if (k == n) {
			printf("%d ", yt[j].number);
			yt[j].number = 0;
			remaining--;
			k = 0;
		}
		j=(j+1)%m;
	}
	return 0;
}

